package cn.zl.model;

import cn.yunbamboos.Model;
import cn.yunbamboos.mybatis.annotation.TableField;
import cn.yunbamboos.mybatis.annotation.TableName;
import cn.yunbamboos.mybatis.annotation.TablePrimaryKey;
import cn.yunbamboos.rest.service.anno.param.ParamType;
import cn.yunbamboos.rest.service.anno.param.enums.Type;
import com.alibaba.fastjson2.JSONObject;

@TableName(value = "zl_device_channel", cn = "国标设备通道表")
public class DeviceChannel implements Model {

    @ParamType(path = "channel_id", type = Type.String, title = "国标设备通道编号", required = true, example = "")
    @TablePrimaryKey(value = "channel_id")
    private String channelId;

    @ParamType(path = "device_id", type = Type.String, title = "国标设备编号", required = true, example = "")
    @TableField(value = "device_id")
    private String deviceId;

    @ParamType(path = "channel_name", type = Type.String, title = "国标设备通道名称", required = true, example = "")
    @TableField(value = "channel_name")
    private String channelName;

    @ParamType(path = "manufacturer", type = Type.String, title = "厂家", required = true, example = "")
    @TableField(value = "manufacturer")
    private String manufacturer;
    @TableField(value = "model")
    private String model;
    @TableField(value = "owner")
    private String owner;
    @TableField(value = "civil_code")
    private String civilCode;
    @TableField(value = "block")
    private String block;
    @TableField(value = "address")
    private String address;
    @TableField(value = "safety_way")
    private String safetyWay;
    @TableField(value = "register_way")
    private String registerWay;
    @TableField(value = "secrecy")
    private String secrecy;
    @TableField(value = "has_audio")
    private boolean hasAudio;

    @ParamType(path = "status", type = Type.Boolean, title = "状态", required = true, example = "false", description = "false 离线,true 在线")
    @TableField(value = "status")
    private boolean status;

    @ParamType(path = "longitude", type = Type.String, title = "经度", required = true, example = "")
    @TableField(value = "longitude")
    private String longitude;

    @ParamType(path = "latitude", type = Type.String, title = "纬度", required = true, example = "")
    @TableField(value = "latitude")
    private String latitude;

    /**
     * 码流标识，优先级高于设备中码流标识
     * 用于选择码流时组成码流标识。默认为null，不设置。可选值: stream/streamnumber/streamprofile/streamMode
     */
    @ParamType(path = "stream_identification", type = Type.String, title = "码流标识", required = true, example = "", description = "默认为null，不设置。可选值: stream/streamnumber/streamprofile/streamMode")
    @TableField(value = "stream_identification")
    private String streamIdentification;

    @ParamType(path = "update_time", type = Type.String, title = "更新时间", required = true, example = "2024-01-01 00:00:00")
    @TableField(value = "update_time")
    private String updateTime;

    @ParamType(path = "create_time", type = Type.String, title = "创建时间", required = true, example = "2024-01-01 00:00:00")
    @TableField(value = "create_time")
    private String createTime;

    @Override
    public JSONObject encode() {
        JSONObject json = new JSONObject();
        json.put("device_id", deviceId);
        json.put("channel_id", channelId);
        json.put("channel_name", channelName);

        json.put("manufacturer", manufacturer);
        json.put("model", model);
        json.put("owner", owner);
        json.put("civil_code", civilCode);
        json.put("block", block);
        json.put("address", address);
        json.put("safety_way", safetyWay);
        json.put("register_way", registerWay);
        json.put("secrecy", secrecy);
        json.put("has_audio", hasAudio);

        json.put("status", status);
        json.put("longitude", longitude);
        json.put("latitude", latitude);
        json.put("stream_identification", streamIdentification);

        json.put("update_time", updateTime);
        json.put("create_time", createTime);
        return json;
    }

    public String getChannelId() {
        return channelId;
    }

    public void setChannelId(String channelId) {
        this.channelId = channelId;
    }

    public String getDeviceId() {
        return deviceId;
    }

    public void setDeviceId(String deviceId) {
        this.deviceId = deviceId;
    }

    public String getChannelName() {
        return channelName;
    }

    public void setChannelName(String channelName) {
        this.channelName = channelName;
    }

    public String getManufacturer() {
        return manufacturer;
    }

    public void setManufacturer(String manufacturer) {
        this.manufacturer = manufacturer;
    }

    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }

    public String getOwner() {
        return owner;
    }

    public void setOwner(String owner) {
        this.owner = owner;
    }

    public String getCivilCode() {
        return civilCode;
    }

    public void setCivilCode(String civilCode) {
        this.civilCode = civilCode;
    }

    public String getBlock() {
        return block;
    }

    public void setBlock(String block) {
        this.block = block;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getSafetyWay() {
        return safetyWay;
    }

    public void setSafetyWay(String safetyWay) {
        this.safetyWay = safetyWay;
    }

    public String getRegisterWay() {
        return registerWay;
    }

    public void setRegisterWay(String registerWay) {
        this.registerWay = registerWay;
    }

    public String getSecrecy() {
        return secrecy;
    }

    public void setSecrecy(String secrecy) {
        this.secrecy = secrecy;
    }

    public boolean isHasAudio() {
        return hasAudio;
    }

    public void setHasAudio(boolean hasAudio) {
        this.hasAudio = hasAudio;
    }

    public boolean isStatus() {
        return status;
    }

    public void setStatus(boolean status) {
        this.status = status;
    }

    public String getLongitude() {
        return longitude;
    }

    public void setLongitude(String longitude) {
        this.longitude = longitude;
    }

    public String getLatitude() {
        return latitude;
    }

    public void setLatitude(String latitude) {
        this.latitude = latitude;
    }

    public String getStreamIdentification() {
        return streamIdentification;
    }

    public void setStreamIdentification(String streamIdentification) {
        this.streamIdentification = streamIdentification;
    }

    public String getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }
}
